<?php



namespace App\Http\Requests\Company;

use Illuminate\Support\Facades\Auth;

class ProductRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title' => 'required|max:120',

        ];
    }

    public function messages()
    {
        return [
            'title.required' => __('请输入产品名'),

        ];
    }

    public function filldata()
    {
        $user= Auth::user();
        return [
            'user_id'=>Auth::id(),
            'title' =>(string) $this->input('title', ''),
            'thumb' => (string)$this->input('thumb', ''),
            'charge'=>(float)$this->input('charge',0.00),
            'stock'=>(int)$this->input('charge',0),
            'point'=>(int)$this->input('charge',0),
            'image_ids'=>(array)$this->input('image_ids',[]),
            'video_ids'=>(int)$this->input('video_ids',0)

        ];
    }
}
